﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using Common;
using DAL;
using Model;
namespace UI.system
{
    public partial class download : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string path = Server.MapPath(Request["path"]);
            FileInfo fi = new FileInfo(path);
            // 判断文件是否存在
            if (fi.Exists)
            {
                // 将文件保存到本机上
                Response.Clear();
                Response.ContentType = "application/octet-stream";
                Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(fi.Name));
                Response.AddHeader("Content-Length", fi.Length.ToString());
                Response.WriteFile(fi.FullName);
                Response.Filter.Close();
                Response.Flush();
                Response.End();
                //DownFile(path);
                
            }
        }
    }
}